package ru.ncedu.java.vlku.hrs.uil.cmd;

import ru.ncedu.java.vlku.hrs.bll.HRSManager;
import ru.ncedu.java.vlku.hrs.bll.HRSManagerFactory;
import ru.ncedu.java.vlku.hrs.model.Cargo;
import ru.ncedu.java.vlku.hrs.model.Price;
import ru.ncedu.java.vlku.hrs.model.Tariff;

public class UpdatePrice implements Command {
    // update price <id> <price>
    @Override
    public void execute(String[] args) {
        if (args.length != 4)
            throw new IllegalArgumentException();
        Long id = Long.parseLong(args[2]);
        Long prval = Long.parseLong(args[3]);

        HRSManager manager = HRSManagerFactory.getInstance().getHRSManager();
        Price price = manager.getPriceById(id);
        price.setPrice(prval);
        manager.updatePrice(price);
    }
}
